{%- macro row(item) -%}
{#    <div class="col-md-{{item.attr.width}}">#}
    <div class="col-md-10">
        {{ block(item.attr.type) }}
    </div>
{%- endmacro -%}

{%- block hidden -%}

    {#        {{ attribute(value,"id") is defined ? value.id :value }} }}#}
{#    <mu-form-item prop="{{ item.attr.name }}" label="{{ item.attr.label }}" :rules="{{ item.attr.rules }}">#}
{#        <mu-text-field v-model="{{ item.attr.entity }}.{{ item.attr.name }}"#}
{#                       placeholder="{{ item.attr.placeholder }}" class="{{ item.attr.class }}"#}
{#                       value="{{  attribute(item.value,"id") is defined ? item.value.id :item.value }}" {{ item.attr.enable ? "":"disabled" }}></mu-text-field>#}
{#    </mu-form-item>#}

{%- endblock -%}

{%- block text -%}
{#        {{ attribute(value,"id") is defined ? value.id :value }} }}#}
        <mu-form-item prop="{{ item.attr.name }}" label="{{ item.attr.label }}" :rules="{{ item.attr.rules }}">
            <mu-text-field v-model="{{ item.attr.entity }}.{{ item.attr.name }}"
                           placeholder="{{ item.attr.placeholder }}" class="{{ item.attr.class }}"
                           value="{{  attribute(item.value,"id") is defined ? item.value.id :item.value }}" {{ item.attr.enable ? "":"disabled" }}></mu-text-field>
        </mu-form-item>

{%- endblock -%}

{%- block textarea -%}

        <mu-form-item prop="{{ item.attr.name }}" label="{{ item.attr.label }}" :rules="{{ item.attr.rules }}">
            <mu-text-field v-model="{{ item.attr.entity }}.{{ item.attr.name }}"
                           placeholder="{{ item.attr.placeholder }}" multi-line :rows="3" :rows-max="9"
                           class="{{ item.attr.class }}"
                           value="{{ item.value }}" {{ item.attr.enable ? "":"disabled" }}></mu-text-field>
        </mu-form-item>

{%- endblock -%}
{% block date %}

        <mu-form-item prop="{{ item.attr.name }}" label="{{ item.attr.label }}" :rules="{{ item.attr.rules }}">
            <mu-date-input value-format="{{ item.attr.format }}" format="{{ item.attr.format }}" landscape actions
                           type="{{ item.attr.isMonth == 1? "month":"date" }}"
                           v-model="{{ item.attr.entity }}.{{ item.attr.name }}"
                           placeholder="{{ item.attr.placeholder }}" class="{{ item.attr.class }}"
                           value="{{ item.value }}"></mu-date-input>
            {#<mu-date-picker landscape :date="{{ item.attr.entity }}.{{ item.attr.name }}"></mu-date-picker>#}
        </mu-form-item>

{% endblock %}
{% block time %}

        <mu-form-item prop="{{ item.attr.name }}" label="{{ item.attr.label }}" :rules="{{ item.attr.rules }}">
            <mu-date-input format="{{ item.attr.format }}" landscape actions
                           type="time" clock-type="24hr" v-model="{{ item.attr.entity }}.{{ item.attr.name }}"
                           placeholder="{{ item.attr.placeholder }}" class="{{ item.attr.class }}"
                           value="{{ item.value }}"></mu-date-input>
        </mu-form-item>

{% endblock %}
{% block datetime %}

        <mu-form-item prop="{{ item.attr.name }}" label="{{ item.attr.label }}" :rules="{{ item.attr.rules }}">
            <mu-date-input value-format="{{ item.attr.format }}" format="{{ item.attr.format }}" landscape actions
                           type="dateTime" clock-type="24hr" v-model="{{ item.attr.entity }}.{{ item.attr.name }}"
                           placeholder="{{ item.attr.placeholder }}" class="{{ item.attr.class }}"
                           value="{{ item.value }}"></mu-date-input>
        </mu-form-item>

{% endblock %}
{%- block select -%}
{#    {{ dump(item.attr) }}#}
        <mu-form-item prop="{{ item.attr.name }}" label="{{ item.attr.label }}" :rules="{{ item.attr.rules }}">
            <mu-select {{ item.attr.find?"filterable":"" }} v-model="{{ item.attr.entity }}.{{ item.attr.name }}"
                    {% if item.attr.isTag %} tags {% endif %}
                     value="{{ item.value }}" {% if item.attr.onChange %} @change="{{ item.attr.onChange }}" {% endif %} {{ item.attr.enable ? "":"disabled" }}>
                {% for value,key in item.attr.choices %}
                    <mu-option
                            {% if item.attr.isText %} value="{{ key }}" {% else %}  value="{{ value }}" {% endif %}
                            label="{{ key }}"></mu-option>{% endfor %}
                {% if item.attr.choices == [] %}
                    <mu-option v-for="item in selectChoices.{{ item.attr.name }}" :label="item.name"
                               :value="item.id" ></mu-option>{% endif %}
            </mu-select>
        </mu-form-item>

{%- endblock -%}


{%- block selectinput -%}
    {#    {{ dump(item.attr) }}#}
    <mu-form-item prop="{{ item.attr.name }}" label="{{ item.attr.label }}" :rules="{{ item.attr.rules }}">
        <mu-auto-complete :data='{{ item.attr.choices|raw }}'  {{ item.attr.enable ? "":"disabled" }}
                          :max-search-results="6"
                          v-model="{{ item.attr.entity }}.{{ item.attr.name }}" open-on-focus ></mu-auto-complete>
    </mu-form-item>
{%- endblock -%}



{%- block checkbox -%}


        <mu-form-item prop="{{ item.attr.name }}" label="{{ item.attr.label }}" :rules="{{ item.attr.rules }}">
            {% for value,key in item.attr.choices %}
                <mu-checkbox v-model="{{ item.attr.entity }}.{{ item.attr.name }}" label="{{ key }}"
                             class="{{ item.attr.class }}" :value="{{ value }}"></mu-checkbox>
            {% endfor %}
        </mu-form-item>


{%- endblock -%}
{%- block radio -%}

        <mu-form-item prop="{{ item.attr.name }}" label="{{ item.attr.label }}" :rules="{{ item.attr.rules }}">
            {% for value,key in item.attr.choices %}
                <mu-radio v-model="{{ item.attr.entity }}.{{ item.attr.name }}" label="{{ key }}"
                          class="{{ item.attr.class }}" :value="{{ value }}"></mu-radio>
            {% endfor %}
        </mu-form-item>

{%- endblock -%}
{#{%- block switch -%}#}
    {#{% spaceless %}#}
    {#<mu-form-item prop="{{ item.attr.name }}" label="{{ item.attr.label }}" :rules="{{ item.attr.rules }}">#}
        {#{% for one in item.choices %}#}
            {#<mu-switch v-model="{{ item.attr.entity }}.{{ item.attr.name }}" label="{{ item.attr.label }}"></mu-switch>#}
            {#<mu-radio v-model="{{ item.attr.entity }}.{{ item.attr.name }}" label="{{ one.value }}" class="{{ item.attr.class }}" value="{{ one.label }}"></mu-radio>#}
        {#{% endfor %}#}
    {#</mu-form-item>#}
    {##}
{#{%- endblock -%}#}
{%- block switch -%}

        <mu-form-item prop="{{ item.attr.name }}" label="{{ item.attr.label }}" :rules="{{ item.attr.rules }}">
            <mu-switch
                    {#input-value="{{ item.attr.entity }}.{{ item.attr.name }}"#}
                       {#v-model="{{ item.attr.entity }}.{{ item.attr.name }}"#}
                       {#v-model="isTrue({{ item.attr.entity }}.{{ item.attr.name }})"#}
                       @change="{{ item.attr.entity }}.{{ item.attr.name }} == 1?Page.{{ item.attr.entity }}.{{ item.attr.name }} =1:Page.{{ item.attr.entity }}.{{ item.attr.name }} =0"></mu-switch>
        </mu-form-item>

{%- endblock -%}
{%- block article -%}

        <mu-form-item prop="{{ item.attr.name }}" label="{{ item.attr.label }}" :rules="{{ item.attr.rules }}">
            <textarea name="{{ item.attr.name }}" v-model="{{ item.attr.entity }}.{{ item.attr.name }}" id="{{ item.attr.class }}" class="{{ item.attr.class }} ueditor"
                      cols="30" rows="10">{{ item.value }}</textarea>
        </mu-form-item>

{%- endblock -%}
{%- block pic -%}

        <mu-form-item prop="{{ item.attr.name }}" label="{{ item.attr.label }}" :rules="{{ item.attr.rules }}">
            <div class="layui-upload">
                <button type="button" class="layui-btn picUpload {{ item.attr.name }}_btn" id="{{ item.attr.name }}">
                    上传图片
                </button>
                <div class="layui-upload-list">
                    <img :src="picUrl(en.{{ item.attr.name }})" style="max-height: 150px;" class="layui-upload-img"
                         id="{{ item.attr.name }}_pre" v-if="isTrue(en.{{ item.attr.name }})">
                    <p id="demoText">
                    </p>
                </div>
            </div>
        </mu-form-item>

{%- endblock -%}

{%- block pics -%}

        <mu-form-item prop="{{ item.attr.name }}" label="{{ item.attr.label }}" :rules="{{ item.attr.rules }}">
            <div class="layui-upload">
                <button type="button" class="layui-btn picsUpload {{ item.attr.name }}_btn" id="{{ item.attr.name }}">
                    上传图片
                </button>
                <div class="layui-upload-list">
                    <div class="flex-r flex-center flex-wrap" id="{{ item.attr.name }}_pre"
                         v-show="isTrue(en.{{ item.attr.name }})">
                        <div v-for="pic,index in en.{{ item.attr.name }}">
                            <img :src="picUrl(pic)" style="max-height: 150px;" class="layui-upload-img previewImg"
                                 id="{{ item.attr.name }}_pre">
                            <div class="tac">
                                <mu-button size="small" @click="ArratDelIndex('{{ item.attr.name }}',index)">删除
                                </mu-button>
                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </mu-form-item>

{%- endblock -%}
{%- block files -%}

        <mu-form-item prop="{{ item.attr.name }}" label="{{ item.attr.label }}" :rules="{{ item.attr.rules }}">
            <div class="layui-upload">
                <button type="button" class="layui-btn  filesUpload {{ item.attr.name }}_btn layui-btn-normal"
                        id="{{ item.attr.name }}">选择多文件
                </button>
                <button type="button" class="layui-btn" id="testListAction">开始上传</button>
                <div class="layui-upload-list">
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th>待上传文件</th>
                            <th>大小</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="{{ item.attr.name }}_pre">
                        </tbody>
                        <tbody id="{{ item.attr.name }}_up">
                        <tr>
                            <th>已上传文件</th>
                            <th>大小</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        <tr v-for="item,index in en.{{ item.attr.name }}">
                            <td>[[item.name]]</td>
                            <td>[[item.file]]</td>
                            <td><span style="color: #5FB878;">已上传</span></td>
                            <td>
                                <mu-button size="small" @click="ArratDelIndex('{{ item.attr.name }}',index)">删除
                                </mu-button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </mu-form-item>

{%- endblock -%}

{%- block file -%}

        <mu-form-item prop="{{ item.attr.name }}" label="{{ item.attr.label }}" :rules="{{ item.attr.rules }}">
            <div class="layui-upload">
                <button type="button" class="layui-btn  fileUpload {{ item.attr.name }}_btn layui-btn-normal"
                        id="{{ item.attr.name }}">选择文件
                </button>
                <button type="button" class="layui-btn" id="testListAction">开始上传</button>
                <div class="layui-upload-list">
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th>待上传文件</th>
                            <th>大小</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="{{ item.attr.name }}_pre">
                        </tbody>
                        <tbody id="{{ item.attr.name }}_up" v-if="isTrue(en.{{ item.attr.name }} )">
                        <tr>
                            <th>已上传文件</th>
                            <th>大小</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        <tr v-for="item in [en.{{ item.attr.name }}]">
                            <td>[[item.name]]</td>
                            <td>[[item.file]]</td>
                            <td><span style="color: #5FB878;">已上传</span></td>
                            <td>
                                <mu-button size="small" @click="ArratDelIndex('{{ item.attr.name }}',index)">删除
                                </mu-button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </mu-form-item>

{%- endblock -%}
{%- block entity -%}
{#        {{ dump(item.attr) }}#}
{#        {{ dump(item.value) }}#}
{#        {{ dump(item.attr) }}#}


    <mu-form-item prop="{{ item.attr.name }}" label="{{ item.attr.label }}" :rules="{{ item.attr.rules }}">
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-striped">
                    {% for key,name in item.attr.choices %}<tr>
                        <td width="40">
                            <mu-checkbox v-model="{{ item.attr.entity }}.{{ item.attr.name }}" class="{{ item.attr.class }}" value="{{ key }}"></mu-checkbox>
                        </td>
                        <td>{{name}}</td>
                        <td width="150" class="tar">{{key}}</td>
                        </tr>{% endfor %}
                </table>
            </div>
        </div>
    </mu-form-item>




{#    <mu-form-item prop="{{ item.attr.name }}" label="{{ item.attr.label }}" :rules="{{ item.attr.rules }}">#}
{#        <mu-select {{ item.attr.find?"filterable":"" }} v-model="{{ item.attr.entity }}.{{ item.attr.name }}"#}
{#                                                        value="{{ item.value }}" {% if item.attr.onChange %} @change="{{ item.attr.onChange }}" {% endif %} {{ item.attr.enable ? "":"disabled" }}>#}
{#            {% for value,key in item.attr.choices %}#}
{#            <mu-option label="{{ key }}" value="{{ value }}" ></mu-option>{% endfor %}#}
{#            {% if item.attr.choices == [] %}#}
{#            <mu-option v-for="item in selectChoices.{{ item.attr.name }}" :label="item.name"#}
{#                       :value="item.id" ></mu-option>{% endif %}#}
{#        </mu-select>#}
{#    </mu-form-item>#}

{%- endblock -%}